---
interface Props {
  pageId: string;
  pageTitle: string;
}

const { pageId, pageTitle } = Astro.props;
---

<div id="cusdis_thread"
  data-host="https://cusdis.com"
  data-app-id="ad5b9283-0758-41bf-bec5-b1f7a6cd05c4"
  data-page-id={pageId}
  data-page-title={pageTitle}
  data-page-url={Astro.url.href}
  data-theme="auto"
  class="w-full"
></div>

<script is:inline defer src="https://cusdis.com/js/cusdis.es.js"></script>

<style is:global>
  /* 评论框容器 */
  #cusdis_thread {
    margin-top: 2rem;
    width: 100%;
  }

  /* 评论输入区域 */
  .cusdis-textarea-wrapper {
    margin-bottom: 1rem;
  }

  .cusdis-textarea {
    width: 100% !important;
    min-height: 120px !important;
    padding: 0.75rem !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 0.5rem !important;
    background-color: white !important;
    font-size: 0.875rem !important;
    line-height: 1.5 !important;
    resize: vertical !important;
  }

  /* 输入框 */
  .cusdis-input {
    width: 100% !important;
    padding: 0.5rem 0.75rem !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 0.375rem !important;
    margin-bottom: 1rem !important;
    font-size: 0.875rem !important;
  }

  /* 提交按钮 */
  .cusdis-button {
    background-color: #3b82f6 !important;
    color: white !important;
    padding: 0.5rem 1rem !important;
    border-radius: 0.375rem !important;
    font-weight: 500 !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
  }

  .cusdis-button:hover {
    background-color: #2563eb !important;
  }

  /* 评论列表 */
  .cusdis-comment {
    padding: 1rem !important;
    border-bottom: 1px solid #e5e7eb !important;
    margin-bottom: 1rem !important;
  }

  .cusdis-comment-author {
    font-weight: 600 !important;
    color: #111827 !important;
    margin-bottom: 0.5rem !important;
  }

  .cusdis-comment-content {
    color: #4b5563 !important;
    line-height: 1.5 !important;
  }

  /* 暗色模式 */
  .dark .cusdis-textarea,
  .dark .cusdis-input {
    background-color: #1f2937 !important;
    border-color: #374151 !important;
    color: #e5e7eb !important;
  }

  .dark .cusdis-button {
    background-color: #60a5fa !important;
  }

  .dark .cusdis-button:hover {
    background-color: #3b82f6 !important;
  }

  .dark .cusdis-comment {
    border-color: #374151 !important;
  }

  .dark .cusdis-comment-author {
    color: #e5e7eb !important;
  }

  .dark .cusdis-comment-content {
    color: #9ca3af !important;
  }

  /* 响应式调整 */
  @media (max-width: 640px) {
    .cusdis-textarea {
      min-height: 100px !important;
    }
  }
</style> 